package com.xiao.hao.enums;


import cn.hutool.core.collection.CollUtil;
import com.xiao.hao.resp.BaseEnums;
import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.List;

@Getter
@AllArgsConstructor
public enum ProblemEnum {

    Problem_1("1", "免疫力"),
    Problem_2("2", "流感|频繁感冒"),
    Problem_3("3", "多动|抽动|专注力"),
    Problem_4("4", "长高|吸收率"),
    Problem_5("5", "脑力发育|记忆力"),
    Problem_6("6", "视力保护"),
    Problem_7("7", "鼻炎"),
    Problem_8("8", "抑郁症"),
    Problem_9("9", "肥胖"),
    Problem_10("10", "自闭症"),
    Problem_11("11", "少年早衰");

    private final String code;
    private final String name;

    public static String getNameByValue(String code) {
        for (ProblemEnum typeEnum : values()) {
            if (typeEnum.getCode().equals(code)) {
                return typeEnum.getName();
            }
        }
        return null;
    }

    public static List<BaseEnums> getEnumRespList() {
        List<BaseEnums> respList = CollUtil.newArrayList();
        for (ProblemEnum baseUnitEnum : values()) {
            respList.add(new BaseEnums(baseUnitEnum.getCode(), baseUnitEnum.getName()));
        }
        return respList;
    }


}
